<template>
    <div class="jfMoney">
        <custom-dialog title="确认缴费" size="small" @dialogClose="dialogClose">
            <div class="userContent">
                <div class="userItem" style="color: #5593e0">最新缴费记录：时间XXX 缴费金额540元 操作人：微信付款</div>
                <div class="userItem" style="color: #905143">当前缴费年份：{{ new Date().getFullYear() }} 年</div>
                <div class="userItem">
                    <label>账户ID：</label>
                    <span>{{ userInfo.ac_id ?? '--' }}</span>
                </div>
                <div class="userItem">
                    <label>账户名称：</label>
                    <span>{{ userInfo.ac_name ?? '--' }}</span>
                </div>
                <div class="userItem">
                    <label>联系人：</label>
                    <span>{{ userInfo.user_name ? userInfo.user_name : '--' }}</span>
                </div>
                <div class="userItem">
                    <label>联系电话：</label>
                    <span>{{ userInfo.user_tel ? userInfo.user_tel : '--' }}</span>
                </div>
                <div class="userItem">
                    <label>邮箱：</label>
                    <span>{{ userInfo.user_email ? userInfo.user_email : '--' }}</span>
                </div>
                <div class="userItem">
                    <label>需缴物业费：</label>
                    <span>{{ userInfo.wyf ? parseFloat(userInfo.wyf).toFixed(2) : '--' }}</span>
                </div>
                <div class="userItem">
                    <label>缴费金额：</label>
                    <span style="color: red">{{ userInfo.wyf ? parseFloat(userInfo.wyf).toFixed(2) : '--' }}</span
                    >元
                </div>
                <div class="userItem">
                    <label>操作人：</label>
                    <span>{{ oprUserName }}</span>
                </div>
                <div class="userItem">
                    <el-button type="primary" @click="print">打印单据</el-button>
                    <el-button type="primary" @click="giveMoeny">确认缴费</el-button>
                </div>
            </div>
        </custom-dialog>

        <wyPrint v-if="showPrint" :oprUserName="oprUserName" :userInfo="userInfo" @close="showPrint = false"></wyPrint>
    </div>
</template>

<script>
import customDialog from '@/components/customComponents/customDialog'
import wyPrint from '@/view/managementCenter/dataReportCenter/components/wyPrint'
import {AjaxCommon} from '@/libs/apiCommon'
import {PopupCommon} from '../../../libs/popupCommon'
export default {
    name: 'jfMoney',
    props: ['userInfo', 'jfje', 'oprUserName'],
    components: {customDialog, wyPrint},
    data() {
        return {
            showPrint: false
        }
    },
    computed: {},
    created() {},
    methods: {
        print() {
            this.showPrint = true
        },
        giveMoeny() {
            // ac_guid
            // pay_sum
            // sgin
            AjaxCommon(
                '/api/Payment/Payment_WY',
                'post',
                {
                    ac_guid: this.userInfo.ac_guid,
                    pay_sum: parseFloat(this.userInfo.wyf),
                    year: new Date().getFullYear()
                },
                true,
                this.jfje
            ).then((res) => {
                console.log(res)
                if (res?.data?.Code == 200) {
                    PopupCommon.notify('success', '缴费成功：' + res.data.Message)
                    this.dialogClose()
                }
            })
        },
        dialogClose() {
            this.$emit('close', '')
        }
    }
}
</script>

<style lang="scss" scoped>
.userItem {
    margin-bottom: 10px;
}
</style>